import request from "@/utils/request";
import Dict from '@/enum/index.js'

const routes = Dict.categoryMap.filter(v => v.value !== 0).map(v => {
  return {
    name: "IndexShare" + v.value,
    path: "index/share" + v.value,
    hidden: false,
    component: "account/index",
    meta: {
      title: v.label,
      icon: "user",
      noCache: false,
      link: null,
      type: v.value,
    },
  }
})
// 获取路由
export const getRouters = () => {
  // return request({
  //   url: '/getRouters',
  //   method: 'get'
  // })
  return new Promise((resolve) => {
    resolve({
      msg: "操作成功",
      code: 200,
      data: [
        {
          name: "Account",
          path: "/account",
          hidden: false,
          redirect: "noRedirect",
          component: "Layout",
          alwaysShow: true,
          meta: {
            title: "账号管理",
            icon: "system",
            noCache: false,
            link: null,
          },
          children: [
            {
              name: "Index",
              path: "index",
              hidden: false,
              component: "account/index",
              meta: {
                title: "用户管理",
                icon: "user",
                noCache: false,
                link: null,
              },
            },
           ...routes
          ],
        },
      ],
    });
  });
};
